home *** CD-ROM | disk | FTP | other *** search
- var illegalChars = /[\D_]/; // allow only digits 0-9
-
-
- function checkNumericOnly(field) {
- var strPass = field.value;
- var strLength = strPass.length - 1;
- var lchar = strPass.charAt(strLength);
-
- if (illegalChars.test(lchar)) {
- field.value = strPass.substring(0, strLength);
- }
- }
-
- function StartUp() {
- var x = document.getElementsByTagName('input');
-
- for (var i=0;i<x.length;i++)
- {
- if (x[i].type == 'text') {
- addEvent(x[i],"focus",SelectAll);
- }
- }
- }
-
- function SelectAll() {
- this.select();
- }
-
- function addEvent( obj, type, fn ) {
- if ( obj.attachEvent ) {
- obj["e"+type+fn] = fn;
- obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
- obj.attachEvent( "on"+type, obj[type+fn] );
- } else
- obj.addEventListener( type, fn, false );
- }
-
- function removeEvent( obj, type, fn ) {
- if ( obj.detachEvent ) {
- obj.detachEvent( "on"+type, obj[type+fn] );
- obj[type+fn] = null;
- } else
- obj.removeEventListener( type, fn, false );
- }